import java.applet.*;
import java.awt.*; 

public class Figure 
{
	int height;
	int width;

	double velocity;
	double location;

	public Figure(int w, int h, double v, double pos) {
		height = w; width = h; velocity = v; location= pos;
		}
	public Figure(int w, int h, double v) {
		height = w; width = h; velocity = v;
		}
	public Figure(int w, int h) {
		this(w,h,0.0);
		}

	public void setSize( int w, int h ) { height = h; width = w; }
	
	public void setVelocity(double v) {
		velocity = v;
	}

	public void setPosition(double pos) {
		location = pos;
	}

	public void draw( Graphics g ) {
		int h = height; 
		int w = width;  
		double v = velocity;
		int x=100,y=100,y0,xs=0,xe=100;
		double T,d,B;
		d=location;
   		T=1.0/Math.sqrt(1-v*v);
		for (y0=0; y0<=30;y0++){
		 xe=(int)(x+T*((100+T*v*d)-v*Math.sqrt((100+T*v*d)*(100+T*v*d)+(y0-d)*(y0-d))));
		 xs=(int)(x+T*((T*v*d)-v*Math.sqrt((T*v*d)*(T*v*d)+(y0-d)*(y0-d))));
		 g.setColor(Color.red);
		 g.drawLine(xs,y+y0,xe,y+y0);	 
  		 g.setColor(Color.black);
	 	 g.fillOval(x,(int)(y+d),5,5);
		} 
	}
}
